package com.zou.recruit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zou.recruit.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author: 邹祥发
 * @date: 2021/9/22 08:53
 */
public interface UserMapper extends BaseMapper<User> {
    @Select("select username from user where username = #{username}")
    String selectName(String username);

    @Select("select password from user where username = #{username}")
    String selectPwdByName(String username);

    @Insert("insert into `user` (username,password) values (#{username},#{password})")
    void registerUser(@Param("username") String username, @Param("password") String password);

    @Update("UPDATE user SET telephone=#{telephone},birthday=#{birthday},mail=#{mail},sex=#{sex},status=#{status},intention=#{intention},experience=#{experience},advantage=#{advantage},project=#{project},education=#{education},salary=#{salary} WHERE username=#{username}")
    void updateResume(@Param("telephone") String telephone,@Param("birthday") String birthday,@Param("mail") String mail,@Param("sex") String sex,@Param("status") String status,@Param("intention") String intention,@Param("experience") String experience,@Param("advantage") String advantage,@Param("project") String project,@Param("education") String education,@Param("salary") String salary,@Param("username") String username);

    @Select("select * from user where username = #{username}")
    User selectAllByName(String username);

    @Update("UPDATE user SET password=#{password} WHERE username=#{username}")
    void editPwd(@Param("password") String password,@Param("username") String username);
}
